/**
 * @param {string} s
 * @return {string}
 */
var replaceSpace = function (s) {
    let res = '';
    for (let i = 0; i < s.length; i++) {
        if (s[i] === ' ') {
            res += '%20';
            continue;
        }
        res += s[i]
    }
    return res;
};


var replaceSpace = function (s) {
    return s.split(' ').join('%20');
};